#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int removeElement(int* nums, int numsSize, int val) {
	int fast = 0; int slow = 0;
	while (fast < numsSize)
	{
		if (nums[fast] == val)
		{
			fast++;
		}
		else
		{
			nums[slow] = nums[fast];
			slow++; fast++;
		}
	}
	return slow;
}
int main()
{
	int n = 0; int arr[20] = { 0 }; int val = 0;
	while (scanf("%d", &n) == 1)
	{
		int i = 0;
		for (i = 0; i < n; i++)
		{
			scanf("%d", &arr[i]);
		}
		scanf("%d", &val);
		int newnum = removeElement(arr, n,val);
		for (i = 0; i < newnum; i++)
		{
			printf("%d ", arr[i]);
		}
		printf("\n");

	}


}